/**
 * Created by eleven on 16/1/11.
 */
function dashuweekpicker(id){
    var weekitem = document.getElementById(id);
    $(weekitem).datepicker({
        format: 'mm-dd-yyyy',
        autoclose:true,
    });
    //Get the value of Start and End of Week
    $(weekitem).datepicker().on( "hide",function (e) {
        var value = $(weekitem).val();
        var yearDate = momentweekpick(value, "MM-DD-YYYY").year() ;
        var weekDate =  momentweekpick(value, "MM-DD-YYYY").week();
        if(momentweekpick(value, "MM-DD-YYYY").month()==11 && momentweekpick(value, "MM-DD-YYYY").week()==1) {
            $(weekitem).val(yearDate+ 1 + "年第" + weekDate + "周" );
        }else{
            $(weekitem).val(yearDate+ "年第" + weekDate + "周");
        }
    });
    $(weekitem).bind("onchange",function(){
        var value = $(weekitem).val();
        if(value!=null) {
            var year = value.split("-W")[0];
            var week = value.split("-W")[1];
            $(weekitem).val(year + "年第" + week + "周" );
            alert("success");
        }

    });
}